package Page.AndroidPages;

import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.pagefactory.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.rules.Timeout;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.PageFactory;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.concurrent.TimeUnit;


public class NewDemo {



    @AndroidFindBy(id = "com.xueqiu.android:id/user_profile_icon")
    public MobileElement myCenter;


    @AndroidFindBy(id = "com.xueqiu.android:id/tv_login")
    public    MobileElement login;


    @AndroidFindBy(id = "com.xueqiu.android:id/tv_login_by_phone_or_others")
    public  MobileElement otherLogin;


    private AndroidDriver driver;
//
//        @Before
//        public void setUp() {
//
//            DesiredCapabilities caps = new DesiredCapabilities();
//            caps.setCapability("platformName", "android");
//            caps.setCapability("deviceName", "test");
//            caps.setCapability("appPackage", "com.xueqiu.android");
//            caps.setCapability("appActivity", ".view.WelcomeActivityAlias");
//            try {
//                driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"),caps);
//            } catch (MalformedURLException e) {
//                e.printStackTrace();
//            }
//
//            driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);

//        final  int TIMEOUT= 10;

//        TimeOutDuration timeOutDuration = new Ti
//        PageFactory.initElements(new AppiumFieldDecorator(driver,TIMEOUT));

//        }


//        @Test
//        public void testCase() {
//            myCenter.click();
//            login.click();
//            otherLogin.click();
//
//            //        driver.findElementById("com.xueqiu.android:id/user_profile_icon").click();
//            //        driver.findElementById("com.xueqiu.android:id/tv_login").click();
//            //        driver.findElementById("com.xueqiu.android:id/tv_login_by_phone_or_others").click();
//        }

    @After
    public void tearDown() {
        driver.quit();
    }



}
